<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		
		<style type="text/css">
			*{
				margin: 0;
				padding: 0;
			}
			#box{
				width: 50px;
				height: 50px;
				background: red;
				position: absolute;
			}
		</style>
		<!--引入-->
		<script src="js/tween.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="box">
				
		</div>
	</body>
	<script type="text/javascript">
		var box = document.getElementById("box");
		var originleft = box.offsetLeft;
//		var i = 0;
//		var timer = setInterval(function(){
//			i += 2;
//			box.style.left = originleft + i + "px";
//			if(i == 600){
//				clearInterval(timer);
//			}
//		},30)
		//可以改进的地方：速率   可以支持低端设备 想一些回弹效果
		//当前时间，但是这个时间并不是毫秒，秒等
		var t = 0;
		var b = originleft;
		var c = 600;
		var d = 100;
		var timer = setInterval(function(){
			t++;
			if(t >= d){
				clearInterval(timer);
			}
			box.style.left = Tween.Bounce.easeOut(t,b,c,d) + "px";
		},30)
		
		
		
		
		
		
	</script>
</html>
